/*
 * =====================================================================================
 *
 *       Filename:  inet_addr.c
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  2019年02月20日 17时47分31秒
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  YOUR NAME (), 
 *   Organization:  
 *
 * =====================================================================================
 */

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <stdint.h>
uint32_t ip = 0;

int main(int argc, char **argv)
{
    if(argc != 2) {
        printf("%s ip\n", argv[0]);
        return 0;
    }
    in_addr_t addr = inet_addr(argv[1]);
    //ip = inet_addr(argv[1]);
    ip = addr;
    printf("addr=%u.%u.%u.%u, ip=%u.%u.%u.%u\n",
            ((uint8_t *)(&addr))[0], ((uint8_t *)(&addr))[1], ((uint8_t *)(&addr))[2], ((uint8_t *)(&addr))[3],
            ((uint8_t *)(&ip))[0], ((uint8_t *)(&ip))[1], ((uint8_t *)(&ip))[2], ((uint8_t *)(&ip))[3]);

    return 0;
}

